home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_pyr_shackexplode.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  298 lines

  1. # Jones 3D Cog Script
  2. #
  3. # pyr_shackexplode.cog
  4. #
  5. # Make the shack blow up when Indy shoots the dynamite
  6. #
  7. # [RKD]
  8. #
  9. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. symbols
  13. message    startup
  14. message    activated
  15. message    entered
  16. message    exited
  17. message    killed
  18. message    pulse
  19.  
  20. # actors
  21. thing    player        nolink    local
  22.  
  23. # camera things and lookthings
  24. thing    boomcam            nolink
  25. thing    boomcamlook        nolink
  26. thing    doorcam            nolink
  27. thing    doorcamlook        nolink
  28. thing    cam1spot        local
  29. thing    cam1look        local
  30.  
  31. # world objects
  32. thing    shack
  33. thing    box2            nolink
  34. thing    box3            nolink
  35. thing    box4            nolink
  36. thing    dynamite0
  37. thing    dynamite1        nolink
  38. thing    dynamite2        nolink
  39. thing    shackend
  40. thing    shackendblown    nolink
  41. thing    zookaghost        nolink
  42.  
  43. # boxes to be made non-pushable
  44. thing    box5            nolink
  45. thing    box6            nolink
  46. thing    box7            nolink
  47. thing    box8            nolink
  48. thing    box9            nolink
  49.  
  50. # surfaces
  51. surface    doormat
  52. surface    shootmat
  53. surface    shootmat2
  54.  
  55. # explosion templates
  56. template    zooka=+dummy_debris    local
  57.  
  58. # voicelines
  59. sound    locked=inxj077.wav        local
  60. sound    wayin=bb03j04.wav        local
  61.  
  62. # music
  63. sound    pyrtheme=mus_aet_pocket_pyr.wav    local
  64.  
  65. # sounds
  66. sound    boxsmash=shs_beamcrash_c.wav    local
  67.  
  68. # variables
  69. int        oktosay=0        local
  70. int        counter=10        local
  71.  
  72. # subroutines
  73. flex    startscene=0.0    local
  74. flex    endscene=0.0    local
  75. flex    fixcams=0.0        local
  76. flex    changecam=0.0    local
  77. end
  78.  
  79.  
  80. code
  81. startup:
  82.     sleep(.01);
  83.     player = GetLocalPlayerThing();
  84.  
  85.     SetThingFlags(shackendblown, 0x10);
  86.     
  87.     # make dynamite non-targettable
  88.     SetActorFlags(dynamite0, 0x100000);
  89.  
  90.     # make other dynamites non-targettable for good
  91.     SetActorFlags(dynamite1, 0x100000);
  92.     SetActorFlags(dynamite2, 0x100000);
  93.     
  94.     # make all dynamite unkillable until player can shoot it legitimately
  95.     SetActorFlags(dynamite0, 0x8);
  96.     SetActorFlags(dynamite1, 0x8);
  97.     SetActorFlags(dynamite2, 0x8);
  98.  
  99.     return;
  100.  
  101. entered:
  102. # ---> doormat, shootmat
  103.  
  104.     if (GetSenderRef() == doormat)
  105.     {
  106.         oktosay = 1;
  107.     }
  108.     else if ((GetSenderRef() == shootmat) || (GetSenderRef() == shootmat2))
  109.     {
  110.         if (dynamite0 != -1)
  111.         {
  112.             # make dynamite targettable
  113.             ClearActorFlags(dynamite0, 0x100000);
  114.             
  115.             # make dynamite killable
  116.             ClearActorFlags(dynamite0, 0x8);
  117.         }
  118.     }
  119.     
  120.     return;
  121.  
  122. exited:
  123. # ---> doormat, shootmat
  124.     
  125.     if (GetSenderRef() == doormat)
  126.     {
  127.         oktosay = 0;
  128.     }
  129.     else if ((GetSenderRef() == shootmat) || (GetSenderRef() == shootmat2))
  130.     {
  131.         if (dynamite0 != -1)
  132.         {
  133.             # make dynamite non-targettable
  134.             SetActorFlags(dynamite0, 0x100000);
  135.             
  136.             # make dynamite non-killable
  137.             SetActorFlags(dynamite0, 0x8);
  138.         }
  139.     }
  140.     
  141.     return;
  142.     
  143. activated:
  144. # ---> shack
  145.     if (GetSenderRef() != shack) return;
  146.     if (dynamite0 == -1) return;
  147.     if (oktosay == 0) return;
  148.  
  149.     # prepare player
  150.     if (MakeMeStop() == -1) return;
  151.     DeselectWeaponWait(player);
  152.     
  153.     StartCutscene(0);
  154.  
  155.     # setup offset camera
  156.     cam1spot = CreateThing(GetThingTemplate(doorcam), doorcam);
  157.     cam1look = CreateThing(GetThingTemplate(doorcam), doorcam);
  158.     MakeCamera2LikeCamera1(cam1spot, cam1look);
  159.     SetCameraLookInterp(2, 0);
  160.     SetCameraPosInterp(2, 0);
  161.     SetCameraFocus(2, cam1spot);
  162.     SetCameraSecondaryFocus(2, cam1look);
  163.     SetCurrentCamera(2);
  164.     ResetCameraFOV(0, 0.0);
  165.     SetCameraLookInterp(2, 1);
  166.     SetCameraPosInterp(2, 1);
  167.     SetCameraInterpSpeed(2, 0.7);
  168.     Sleep(0.01);
  169.     SetCameraFocus(2, doorcam);
  170.     SetCameraSecondaryFocus(2, doorcamlook);
  171.  
  172.     # indy vs. the door again
  173.     PlayMode(player, 60, 1);
  174.     PlayVoice(player, locked, 1, 1);
  175.     PlayVoice(player, wayin, 1, 1);
  176.     
  177.     Sleep(0.25);
  178.  
  179.     # restore camera and get rid of objects
  180.     SetCameraLookInterp(2, 0);
  181.     SetCameraPosInterp(2, 0);
  182.     SetCameraPosition(1, GetThingPos(doorcam));
  183.     SetCurrentCamera(1);
  184.     DestroyThing(cam1spot);
  185.     DestroyThing(cam1look);
  186.  
  187.     # finish up
  188.     ClearActorFlags(player, 0x200000);
  189.     EndCutscene();
  190.     return;
  191.  
  192. killed:
  193. # ---> dynamite
  194.     if (GetSenderRef() != dynamite0) return;
  195.     
  196.     PlaySoundLocal(pyrtheme, 1, 0, 0, 0);
  197.     dynamite0 = -1;
  198.     setpulse(.1);
  199.     
  200.     call startscene;
  201.     call changecam;
  202.  
  203.     sleep(.1);
  204.  
  205.     # blow other dynamite boxes up
  206.     ClearActorFlags(dynamite1, 0x8);
  207.     ClearActorFlags(dynamite2, 0x8);
  208.     DamageThing(dynamite1, 60, 0x1, player);
  209.     
  210.     # destroy boxes and good end of shack
  211.     DestroyThing(box2);
  212.     DestroyThing(box3);
  213.     DestroyThing(box4);
  214.     DestroyThing(shackend);
  215.     
  216.     # create explosion projectile, make blown shack visible, play sounds
  217.     CreateThing(zooka, zookaghost);
  218.     ClearThingFlags(shackendblown, 0x10);
  219.     PlaySoundThing(boxsmash, shackendblown, 1, -1, -1, 0);
  220.  
  221.     sleep(3);
  222.  
  223.        # make crates non-pushable
  224.     ClearThingFlags(box5, 0x40000000);
  225.     ClearThingFlags(box6, 0x40000000);
  226.     ClearThingFlags(box7, 0x40000000);
  227.     ClearThingFlags(box8, 0x40000000);
  228.     ClearThingFlags(box9, 0x40000000);
  229.  
  230.     call endscene;
  231.     
  232.     return;
  233.  
  234. changecam:
  235.     #change to boomcam
  236.     SetCameraFocus(2, boomcam);
  237.     SetCameraSecondaryFocus(2, boomcamlook);
  238.     SetCurrentCamera(2);
  239.     ResetCameraFOV(0, 0);
  240.     return;
  241.  
  242. startscene:
  243.     call fixcams;
  244.  
  245.     StartCutscene(1);
  246.     StopThing(player);
  247.     SetActorFlags(player, 0x200000);
  248.         
  249.     return;
  250.             
  251. endscene:
  252.     call fixcams;
  253.  
  254.     ClearActorFlags(player, 0x200000);
  255.  
  256.     SetCurrentCamera(1);
  257.     EndCutscene();
  258.  
  259.     # clean up
  260.     DestroyThing(boomcam);
  261.     DestroyThing(boomcamlook);
  262.     DestroyThing(doorcam);
  263.     DestroyThing(doorcamlook);
  264.     DestroyThing(zookaghost);
  265.  
  266.     return;
  267.  
  268. fixcams:
  269.     #reset camera settings
  270.     ResetCameraFOV(0, 0);
  271.     SetCameraPosInterp(2, 0);
  272.     SetCameraLookInterp(2, 0);
  273.     SetCameraPosInterp(1, 0);
  274.     SetCameraLookInterp(1, 0);
  275.     RestoreExtCam();
  276.     return;
  277.  
  278. pulse:
  279.     
  280.     if (counter > 1)
  281.     {
  282.         counter = counter - 1;
  283.  
  284.         SetPOVShake(VectorScale(VectorSet(RandBetween(-1, 1), RandBetween(-1, 1), RandBetween(-1, 1)), .0005 * counter),
  285.                     VectorScale(VectorSet(RandBetween(-6, 6), RandBetween(-4, 4), RandBetween(-2, 2)), .05 * counter),
  286.                     10, 180);
  287.     }
  288.     else
  289.     {
  290.         SetPulse(0);
  291.         counter=0;
  292.     }
  293.  
  294.     return;
  295.  
  296. end
  297.  
  298.